<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
	<title>通知详情</title>
	<link rel="stylesheet" type="text/css" href="../../css/aui-win.css" />
<style>
* {
				margin: 0;
				padding: 0;
			}
			body{
				width: 100%;
				margin: 0;
				padding: 0;
			}
			#yunzo-bg {
			}
			#yunzo-bg > h3 {
				margin-bottom: 5px;
				padding-left: 5%;
				font-size: 20px;
			}
			#yunzo-bg > p {
				padding-left: 2.5%;
				font-size: 1em;
			}
			#txtNewsList {
				overflow: scroll;
			}
			
			#titles {
				margin-left: 2.5%;
				margin-top: 10px;
				font-weight: 500;
				font-size:16px;
			}
			#footTop{
				color:#999;
				font-size:12px;
				margin-top:3px;
			}
			.time {
				font-size: 12px;
				color: gray;
				margin-bottom:5px;
			}
			.striping {

				height: 10px;
				background: white;
				
			}
			#comment{
				margin-top: 10px;
				padding: 0 2.5%;
				font-size: 14px;
				line-height: 20px;
				width:95%;
				color:#333;		
				line-height:22px;
			}
			#comment P{
				
			}
			#comment table{
				width:100% !important;
			}
			#comment img{
				width:100%;
				display:inline-block;
			}
			#comment span{
				
			}
			.foot {
				padding-left: 2.5%;
			}
			.icon {
				margin-left: 5px;
				width:12px;
				height:12px;
			}
			.clickShow {
				border-radius: 5px;
				margin-right: 20px;
				padding: 2px;
			}
			.comments {
				color:#00abfd;
				font-size:15px;
				float:left;
				width:50%;
				border-right:1px solid #ccc;
				text-align:center;
			}
			.comment{
				color:#00abfd;
				font-size:15px;
				float:right;
				width:49%;
				text-align:center;
			}
			#footBot {
				margin-top: 10px;
				width: 100%;
			}
			#footBot img {
				margin-right: 1%;
				width: 40px;
				height: 40px;
				border-radius: 40%;
			}
			.footStr {
				height: 10px;
				background: #f5f5f5;
			}
			#foot_bottom{
				border-top:1px solid #ccc;
				position:fixed;
				bottom:0;
				height:35px;
				background:white;
				width:100%;
				padding-top:10px;
			}
			.part{
				position: absolute;
				right:2.5%;
				top:12px;
				z-index:999;
			}
			#mrg_bttn{
				height:45px;
			}
</style>
</head>
<body style="background:none;">
    <div class="div_loding_img">
		数据加载中
	</div>

	<header class="aui-bar aui-bar-nav aui-bar-yunzo" id="aui-header">
		<a class="aui-btn aui-bar-yunzo aui-pull-left" id="back"> <span class="aui-iconfont aui-icon-left"></span></a>
		<div class="aui-title" id="title">
			通知详情
		</div>
		
	</header>
	<div class="margin_div"></div>
	<div class="part"></div>
	<div id="txtNewsList">
		<div id="yunzo-bg" class="content">
			<div>
				<h3 id="titles" style="font-weight:bold;font-size:18px;"></h3>
			</div>
			
			<div class="foot" id="foot">
				<div id="footTop"></div>
				<div id="footBot"></div>
			</div>
			<div class="striping"></div>
			<div class="footStr" style="background:#f5f5f5;"></div>
			<div id="comment"></div>
			<div id="mrg_bttn"></div>
			<div id="foot_bottom"></div>
		</div>
	</div>
<script src="../../script/jquery-1.10.2.min.js"></script>
<script src="../../script/common.js"></script>
<script type="text/javascript">
function part(num){
	var type;
	if(num==1){
		type=0;
		
	}
	if(num==0){
		type=1;
		
	}
	if(type==0){
		var panduan	=confirm("是否参加？");
		if(panduan==true){
			let(type)
		}
		else{
			
		}
	}
	if(type==1){
		var panduan=confirm("是否取消参加？");
		if(panduan==true){
			let(type)
		}
		else{
			
		}
	}
	
}
function let(le){
	type=le;
	var infoid=getUrlParam("infoid");
	var post=basedata('informinfo')+"&infoid="+infoid+"&type="+type;
	ajaxcocRequest('../../../api/group/joingroupinforminfo', 'post', post, function(msg){
		if(msg.code==100){
			if(type==0){
				alert("您已参加！")
				getInfoData(post)
			}
			if(type==1){
				alert("您已取消！")
				getInfoData(post)
			}
		}
		else{
			alert("无法点赞！")
		}
	})
}
var infoid;
var did;
var comments;
var brows;
var footBot;
var htmlAll;
var html1;
var $beginTime;
var $endTime;
var visitors;
var baseDatas;
var postparam;
$(document).ready(function(){ 
	goback('inform_list.html');
	did=initdata.get('informinfo');
	infoid=getUrlParam("infoid");
	comments=getUrlParam("comments");
	brows=getUrlParam("brows");
	baseDatas=basedata('informinfo');
    postparam=baseDatas+"&infoid="+infoid;
    footBot = $("#footBot");
	$beginTime = $('#beginTime');
	$endTime = $('#endTime');
	
    getInfoData(postparam);
});
function getInfoData(post)
{	
	$(".div_loding_img").css("display","block")
	ajaxcocRequest('../../../api/group/getgroupinforminfoObject', 'post', post, function(msg){
		if (msg.code==100) {
			//详情展示		
			if(msg.datum.n8==0){
				$(".part").html('<a style="margin-left:210px;font-size:14px;color:#ffffff;" onclick="part(\'' + msg.datum.n8 + '\')">已参加过</a>')
			}
			if(msg.datum.n8==1){
				$(".part").html('<a style="margin-left:210px;font-size:14px;color:#ffffff;" onclick="part(\'' + msg.datum.n8 + '\')">我要参加</a>')
			}
			var winHeight = $(document.body).height();
			var winWidth =$(document.body).width();
			var obj = $('#txtNewsList');					
			obj.height(winHeight - 40);
			var $titles = $("#titles");
			var $comment = $('#comment');
			var $footTop = $("#footTop");
			
			var html = "";
			var htmllll="";
			var thisItem = msg.datum;
			$titles.html(thisItem.n2);
			$beginTime.html(thisItem.n4.split(',')[0]);
			$endTime.html(thisItem.n4.split(',')[1]);
			var zanSrc;
			var brows = thisItem.n9.length;
			if (thisItem.n7 == 0) {
				zanSrc = "../../image/home/busess/nozan.png"
			} else {
				zanSrc = "../../image/home/busess/zan.png"
			}
			html += '共有<span id="counts">' + brows + '</span>人看过 '
			htmllll= '<a class="comments" tapmode="active" onclick="thumbUp(\'' + thisItem.n0 + '\',' + thisItem.n7 + ')"><img class="icon" id="zanImg" src="' + zanSrc + '" > 赞(<span id="zan">' + thisItem.n6 + '</span>)</a><a class="comment" tapmode="active" onclick="openNews(\'' + thisItem.n0 + '\',' + did + ')"><img class="icon" src="../../image/home/busess/pinglun.png"> 评论(<span id="comments">' + comments + '</span>)</a>';
			htmlAll = "";
			html1 = "";
			if (thisItem.n9 != null) {
				for (var i = 0, len = thisItem.n9.length; i < len; i++) {
					if (thisItem.n9[i].n1 != null) {
						if (thisItem.n9[i].n1.indexOf(",") != -1) {
							htmlAll += '<img onclick="opeinmemberinfo(\'' + thisItem.n9[i].n0 + '\')" src="' + thisItem.n9[i].n1.split(",")[i] + '">';
						} else
							htmlAll += '<img onclick="opeinmemberinfo(\'' + thisItem.n9[i].n0 + '\')" src="' + thisItem.n9[i].n1 + '">';
					} else {
						htmlAll += '<img  onclick="opeinmemberinfo(\'' + thisItem.n9[i].n0 + '\')" src="../../image/yunzo_def.png">';
					}
				}
				htmlAll += '<img src="../../image/home/busess/showMore.png" onclick="closeDiv()">'
				for (var i = 0, len = thisItem.n9.length; i < len; i++) {
					//alert(thisItem.n9[i].n1.split(",")[i]);
					if (i <= 4) {
						if (thisItem.n9[i].n1 != null) {
							if (thisItem.n9[i].n1.indexOf(",") != -1) {
								html1 += '<img onclick="opeinmemberinfo(\'' + thisItem.n9[i].n0 + '\')" src="' + thisItem.n9[i].n1.split(",")[i] + '">';
							} else
								html1 += '<img onclick="opeinmemberinfo(\'' + thisItem.n9[i].n0 + '\')" src="' + thisItem.n9[i].n1 + '">';
						} else {
							html1 += '<img  onclick="opeinmemberinfo(\'' + thisItem.n9[i].n0 + '\')" src="../../image/yunzo_def.png">';
						}
					} else if (i == 5) {
						html1 += '<img src="../../image/home/busess/showMore.png" onclick="showDiv()">'
					}
				}
			} else {
				html1 += '<img  src="../../image/yunzo_def.png">';
			}
			footBot.html("");
			$footTop.html("");
			footBot.append(html1);
			$footTop.append(html);
			$("#foot_bottom").html(htmllll);
			$(".div_loding_img").css("display","none")
			//var cot=thisItem.n3;
			 //var dds = cot.replace(/&nbsp;/g, "");
			 $comment.html(thisItem.n3.replace(/&nbsp;/g, ""));
			var tags = $comment.find('*');
			var imgs = $comment.find('img');
			var ps = $comment.find('p');										
			
			for(var j=0;j<imgs.length;j++){		
				imgs[j].error(function(){
					$(this).attr("src","../../image/upload.png");
				})
				
			}
			for (var i = 0; i < tags.length; i++) {
				tags[i].removeAttribute('style');
			}
			for (var k = 0; k < ps.length; k++) {
				ps[k].removeAttribute('style');
			}
		} else {
			$("body").append('<div class="zhedang"><div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div></div>')
			$(".div_loding_img").css("display","none")
		}
	});
}
function opeinmemberinfo(mid)
{	
	window.location='selfinfo.html'+'?infoid='+mid;
}
function showDiv() {
	footBot.html("");
	footBot.append(htmlAll);
}

function closeDiv() {
	footBot.html("");
	footBot.append(html1);
}
//点赞
function thumbUp(bid, type) {
	ajaxcocRequest('../../../api/userproetformid', 'POST', baseDatas + '&type='+(type==0?1:0)+'&pid=' + bid, function(msg) {
		if (msg.code==100) {
			
			//详情展示
			getInfoData(postparam);
		} else {
			$("body").append('<div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div>')
		}
	})
	
}

//评论
function openNews(pid,did){
	if($mtype=="guest")
		{
			alert("您是游客哦");
		}else{
	var localData =  window.localStorage;
	window.location ="comment_info.html?pid="+pid+"&did="+did+"&path=inform_info.html";
	}
} 

</script>
</body>
</html>